<template>
	
	<view class="con">
		<CustomNavbar></CustomNavbar>
		<view class="richtext" @click="onJump()">
			<rich-text :imgOptions="imgOptions" :nodes="processedContent"></rich-text>
		    <!-- <u-parse :content="list.brand_detail.content" :imgOptions="imgOptions"></u-parse> -->
		</view>
		<side-bar></side-bar>
	</view>

</template>

<script>
	import{indexBrand} from '@/api/levelTwo.js'
	import{sceneList} from '@/api/goodsList.js'
	import sideBar from "@/components/sheet/sideBar.vue"
	import CustomNavbar from "@/components/CustomNavbar.vue"
	import {getUserInfo} from '@/api/my.js'
	export default {
		data() {
			return {
				list:{},
				currentOne:0,
				id:'',
				phoneNumber:'',//客服电话
				imgOptions: {
					mode: 'aspectFit', // 图片显示模式
					ignore: true // 禁用默认的图片预览行为
				},
				type:'',
				processedContent:''
			}
		},
		components: {
			sideBar,
			CustomNavbar
		},
		onLoad(options) {
			console.log(options)
			this.type = options.type;
			this.brand_id = options.brand_id;
			console.log(this.brand_id)
			let custom = uni.getMenuButtonBoundingClientRect(); // 小程序右上角胶囊信息
			let system = uni.getSystemInfoSync(); // 获取设备信息
			this.navHeight = system.statusBarHeight + 44; // 导航栏的高度
			this.customTop = custom.top; // 胶囊按钮与顶部的距离
			this.customHeight = custom.height; // 胶囊按钮与右侧的距离
			this.gettopCate();
			
		},
		methods: {
			onJump(){
				if(this.list.brand_detail.is_jump_goods_list != 0){
					uni.navigateTo({
					  url: '/package/goodsList/indextwo?type=1'
					});
				}
			},
			gettopCate(){
				console.log(this.brand_id)
				let data = {
					brand_id:this.brand_id
				}
				indexBrand(data).then(res => {
					 this.list = res.data;
					 this.processedContent = this.list.brand_detail.content.replace(
					             /<img /g,
					             '<img style="width:100%;height:auto;" '
					         );
				}).catch(err => {
					uni.showToast({
						title: err.msg,
						icon: "none"
					})
				})
			},
		}
	}
</script>

<style lang="scss">
	.richtext img{
		display: block;
		width: 100%;
	}
	@import 'index.scss';
</style>